package com.huluobo.h3kotlinproject.category

import androidx.lifecycle.MutableLiveData
import com.huluobo.h3kotlinproject.base.BaseViewModel
import com.huluobo.h3kotlinproject.data.GoodsListResult

/**
 *  Created by LC on 2023/10/27.
 */
class CategoryViewModel : BaseViewModel() {
    val categoryParentSuccess = MutableLiveData<CategoryBeanResult>()
    val categoryParentFailed = MutableLiveData<String>()

    val categoryListSuccess = MutableLiveData<GoodsListResult>()
    val categoryListFailed = MutableLiveData<String>()

    val repo = CategoryRepo()

    fun getCategoryParent() {
        repo.getCategoryList(categoryParentSuccess, categoryParentFailed)
    }

    fun getCategoryList(categoryId: Int, currentPage: Int, pageSize: Int) {
        repo.getGoodList(categoryId, currentPage, pageSize, categoryListSuccess, categoryListFailed)
    }
}